<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>屠宰接收</title>
    <link href="../../css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="../../font-awesome/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="../../css/animate.css" rel="stylesheet">
    <link href="../../css/style.css?v=2.2.0" rel="stylesheet">

</head>
<body class="top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom white-bg">
            <nav class="navbar navbar-static-top" role="navigation">
                <div class="navbar-header">
                    <button aria-controls="navbar" aria-expanded="false" data-target="#navbar" data-toggle="collapse" class="navbar-toggle collapsed" type="button">
                        <i class="fa fa-reorder"></i>
                    </button>
                    <a href="Slaughter_navigation.html" class="navbar-brand">PIE</a>
                </div>
                <div class="navbar-collapse collapse" id="navbar">
                    <ul class="nav navbar-nav">
                        <li class="active">
                            <a aria-expanded="false" role="button" href="Slaughter_navigation.html"> 返回主页</a>
                        </li>
                    </ul>
                    <ul class="nav navbar-top-links navbar-right">
                        <li id="logout">
                            <a href="">
                                <i class="fa fa-sign-out"></i> 退出
                            </a>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>


        <div class="middle-box text-center loginscreen   animated fadeInDown">
            <div>
                <div class="ibox-content">
                    <div>
                        <h3 class="">待宰接收</h3>
                    </div>
                    <form class="m-t" role="form"  id="form" action="../login/Login.html">
                        <div class="form-group">
                            <input type="text" class="form-control" id="pigId" name="pigid" placeholder="猪ID" required="">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" id="slaughterId" name="slaughterid" placeholder="屠宰场ID" required="">
                        </div>
                        <div class="form-group">
                            <input type="text" class="form-control" id="checkerId" name="checkerid"placeholder="检疫人ID" required="">
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label">
                                <br/>
                                <small class="control-label">检疫结果</small>
                            </label>
                            <div class="col-sm-8">
                                <div class="radio">
                                    <label>
                                        <input type="radio"  value="1" id="optionsRadios1" name="optionsRadios">合格&nbsp;&nbsp;&nbsp;</label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio"  value="0" id="optionsRadios2" name="optionsRadios">不合格</label>
                                </div>
                            </div>
                        </div>
                        <button type="button" class="btn btn-primary block full-width m-b" id="btn">提交</button>
                        </p>
                    </form>
                </div>
            </div>
        </div>



        <div class="footer">
            <div class="pull-right">
                By：<a href="http://www.zi-han.net" target="_blank">zihan's blog</a>
            </div>
            <div>
                <strong>Copyright</strong> H+ &copy; 2014
            </div>
        </div>

    </div>
</div>
<!-- Mainly scripts -->
<script src="../../js/jquery-3.3.1.js"></script>
<script src="../../js/bootstrap.min.js?v=3.4.0"></script>

<script>
    $(document).ready(function(){
        $("#btn").click(function(){
            var checker={
                id:$("#pigId").val(),
                slaughterId:$("#slaughterId").val(),
                checkerId:$("#checkerId").val(),
                isCheck:$('input:radio:checked').val()
            }
            var Checker=JSON.stringify(checker);
            $.post({
                url: "http://localhost:8080/slaughterreception",
                headers: {
                    "content-Type": "application/json;charset=utf-8"
                }
            },Checker,function (data) {
                if(data=="请先登录")
                {
                    alert(data);
                    location.assign("http://localhost:8080/login/Login.html");
                }
                else {
                    alert(data);
                    location.reload();
                }
            })
        })

    })
</script>
<script src="../../js/plugins/validate/jquery.validate.min.js"></script>
<script src="../../js/plugins/validate/messages_zh.min.js"></script>
<script>
    $(document).ready(function () {
        $("#form").validate({
            rules:{
                pigid:{
                    required:true,
                    number:true,
                    minlength:13,
                    maxlength:13
                },
                slaughterid:{
                    required:true,
                    number:true,
                    minlength:6,
                    maxlength:6
                },
                checkerid:{
                    required:true,
                    number:true,
                    minlength:18,
                    maxlength:18
                }
            }
        })
    })
</script>
<script>
    $("#logout").click(function(){
        $.get("http://localhost:8080/logout",function () {
            location.assign("http://localhost:8080/PorkTraceability/login/Login.html");
        })
    })
</script>
</body>
</html>








